<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends AdminController 
{
    public function index()
    {
        $this->display();
    }
    
    public function spbj()
    {
        //************2.比价简单查询接口************
        $appkey="e5e49a5b08db2afd1d8b681096f6769d";
        $keyword=urlencode(I('post.name'));
        $url = "http://japi.juhe.cn/manmanmai/simple.from";
        $params = array(
              "keyword" => $keyword,//要查询关键字
              "key" => $appkey,//应用APPKEY(应用详细页查询)
        );
        $paramstring = http_build_query($params);
        $content = juhecurl($url,$paramstring);
        $data = json_decode($content,true);
        $this->assign('data',$data['result']);
        if($data){
            if($data['error_code']=='0'){
                $this->display('index/index');
            }else{
                echo $data['error_code'].":".$data['reason'];
            }
        }else{
            echo "请求失败";
        }
    }


}